import styled from "@emotion/styled"
import { PageHeader } from "@/pages/AccountPage/components/PageHeader"
import { memo } from "react"

const Root = styled.div`
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    flex: 1;
`
const LineBackground = styled.div`
    height: 144rem;
    width: 100%;
    position: absolute;
    background: linear-gradient(180deg, #ffcce6 0%, #ffffff 100%);
    z-index: 2;
    top: 0;
`
const RadialBackground = styled.div`
    background: radial-gradient(
        49.87% 100% at 0% 0%,
        rgba(255, 247, 153, 0.5) 0%,
        rgba(255, 246, 153, 0) 100%
    );
    position: absolute;
    top: 0;
    height: 88rem;
    width: 100%;
    z-index: 3;
`

const Content = styled.div`
    flex: 1;
    z-index: 9;
    display: flex;
    flex-direction: column;
`
const TopBox = styled.div`
    width: 100%;
    height: 84rem;
    margin-top: 16rem;
    padding: 0 24rem;
`

const Title = styled.div`
    font-family: "Gilroy";
    font-size: 24rem;
    font-weight: 600;
    line-height: 32rem;
    color: #131416;
    height: 36rem;
`

const Description = styled.div`
    font-family: "Gilroy";
    font-size: 14rem;
    font-weight: 400;
    line-height: 20rem;
    color: #40444f;
    margin-top: 8rem;
`
const BodyBox = styled.div`
    width: 100%;
    flex: 1;
    background: white;
    padding: 0 24rem;
`

interface FormLayoutProps {
    title: string
    description: string
    backPath: string
    children: React.ReactNode
}

const FormLayout = ({ title, description, backPath, children }: FormLayoutProps) => {
    return (
        <Root>
            <LineBackground />
            <RadialBackground />
            <PageHeader
                title=""
                iconType="black-arrow"
                backPath="/s-account"
                backgroundColor="transparent"
            />
            <Content>
                <TopBox>
                    <Title>{title}</Title>
                    <Description>{description}</Description>
                </TopBox>
                <BodyBox>{children}</BodyBox>
            </Content>
        </Root>
    )
}

export default memo(FormLayout)
